import {
  ACTION_SET_FROM,
  ACTION_SET_TO,
  ACTION_SET_DEPART_DATE,
  ACTION_SET_HIGH_SPEED,
  ACTION_SET_TRAIN_LIST,
  ACTION_SET_ORDER_TYPE,
  ACTION_SET_ONLY_TICKETS,
  ACTION_SET_TICKET_TYPES,
  ACTION_SET_CHECKED_TICKET_TYPES,
  ACTION_SET_TRAIN_TYPES,
  ACTION_SET_CHECK_TRAIN_TYPES,
  ACTION_SET_DEPART_STATIONS,
  ACTION_SET_CHECK_DEPART_STATIONS,
  ACTION_SET_ARRIVE_STATIONS,
  ACTION_SET_CHECK_ARRIVE_STATIONS,
  ACTION_SET_DEPART_TIME_START,
  ACTION_SET_DEPART_TIME_END,
  ACTION_SET_ARRIVE_TIME_START,
  ACTION_SET_ARRIVE_TIME_END,
  ACTION_SET_IS_FILTERS_OPEN,
  ACTION_SET_SEARCH_PARSED
} from './actions'
import {ORDER_DEPART, ORDER_DURATION} from './constant'

export default {
  from (state=null, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_FROM:
        return payLoad
      default:
    }
    return state
  },
  to (state=null, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_TO:
        return payLoad
      default:
    }
    return state
  },
  departDate (state=Date.now(), action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_DEPART_DATE:
        return payLoad
      default:
    }
    return state
  },
  highSpeed (state=false, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_HIGH_SPEED:
        return payLoad
      default:
    }
    return state
  },
  trainList (state=[], action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_TRAIN_LIST:
        return payLoad
      default:
    }
    return state
  },
  orderType (state=ORDER_DEPART, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_ORDER_TYPE:
        return payLoad
      default:
    }
    return state
  },
  onlyTickets (state=false, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_ONLY_TICKETS:
        return payLoad
      default:
    }
    return state
  },
  ticketTypes (state=[], action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_TICKET_TYPES:
        return payLoad
      default:
    }
    return state
  },
  checkedTicketTypes (state={}, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_CHECKED_TICKET_TYPES:
        return payLoad
      default:
    }
    return state
  },
  trainTypes (state=[], action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_TRAIN_TYPES:
        return payLoad
      default:
    }
    return state
  },
  checkTrainTypes (state={}, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_CHECK_TRAIN_TYPES:
        return payLoad
      default:
    }
    return state
  },
  departStations (state=[], action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_DEPART_STATIONS:
        return payLoad
      default:
    }
    return state
  },
  checkDepartStations (state={}, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_CHECK_DEPART_STATIONS:
        return payLoad
      default:
    }
    return state
  },
  arriveStations (state=[], action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_ARRIVE_STATIONS:
        return payLoad
      default:
    }
    return state
  },
  checkArriveStations (state={}, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_CHECK_ARRIVE_STATIONS:
        return payLoad
      default:
    }
    return state
  },
  departTimeStart (state=0, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_DEPART_TIME_START:
        return payLoad
      default:
    }
    return state
  },
  departTimeEnd (state=24, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_DEPART_TIME_END:
        return payLoad
      default:
    }
    return state
  },
  arriveTimeStart (state=0, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_ARRIVE_TIME_START:
        return payLoad
      default:
    }
    return state
  },
  arriveTimeEnd (state=24, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_ARRIVE_TIME_END:
        return payLoad
      default:
    }
    return state
  },
  isFiltersOpen (state=false, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_IS_FILTERS_OPEN:
        return payLoad
      default:
    }
    return state
  },
  searchParsed (state=false, action) {
    const {type, payLoad} = action
    switch(type) {
      case ACTION_SET_SEARCH_PARSED:
        return payLoad
      default:
    }
    return state
  },
}